#ifndef INSTANCE_H
#define INSTANCE_H


#include "ListOfFunctions.h"
#include "ErkangStruct.h"
#include "PhysicalDevice.h"

#include <vector>
#include <map>
#include <string>


namespace ErkangShuttle
{
	struct PhysicalDeviceStructInstance
	{
		PhysicalDevice* _pPhysicalDevice{ nullptr };
		PhysicalDeviceStruct _PhysicalDeviceStruct;
	};
	class Instance
	{
	public:
		Instance() = delete;
		Instance(InstanceStruct*);
		~Instance();
		void init();
		uint32_t getSupportPhysicalDeviceCount();
		PhysicalDevice& getPhysicalDevice(const std::string&);
		PhysicalDevice& operator[](const std::string&);

		const std::vector<std::string>& getAllAvailablePhysicalDevices();
		void setDefaultPhysicalDevice(const std::string&);
	private:
		bool GetAllAvailablePhysicalDevices();
		ListOfPhysicalDeviceFunctions* LoadPhysicalDeviceFunctions(VkPhysicalDevice*);

		ListOfInstanceFunctions& m_ListOfInstanceFunctions;
		VkInstanceCreateInfo& m_VkInstanceCreateInfo;
		VkInstance& m_VkInstance;
		std::vector<VkExtensionProperties>& m_VkInstanceExtensions;
		std::vector<const char*>& m_VkInstanceExtensionNames;
		
		std::map<std::string, PhysicalDeviceStructInstance*> m_AllAvailablePhysicalDeviceStructInstance;
		std::vector<VkPhysicalDevice> m_AllAvailableVkPhysicalDevices;
		std::vector<std::string> m_AllAvailablePhysicalDeviceName;
		std::string m_DefaultPhysicalDeviceName;
	};
}

#endif // INSTANCE_H
